package com.treetao.union.web.controller;

import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;

import com.treetao.union.db.model.SysUser;
import com.treetao.union.db.model.vo.ShiroUser;
import com.treetao.union.db.service.SysDictService;
import com.treetao.union.db.service.SysLogService;
import com.treetao.union.db.service.SysMenuService;
import com.treetao.union.db.service.SysRescourceService;
import com.treetao.union.db.service.SysRoleService;
import com.treetao.union.db.service.SysSiteService;
import com.treetao.union.db.service.SysUserService;

public class BaseAdminController extends BaseController {
	@Autowired
	protected SysUserService sysUserService;

	@Autowired
	protected SysMenuService sysMenuService;

	@Autowired
	protected SysRoleService sysRoleService;

	@Autowired
	protected SysDictService sysDictService;

	@Autowired
	protected SysRescourceService sysRescourceService;

	@Autowired
	protected SysLogService sysLogService;

	@Autowired
	protected SysSiteService sysSiteService;

	public SysUser getCurrentUser() {
		ShiroUser shiroUser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
		if (shiroUser == null) {
			return null;
		}
		SysUser loginUser = sysUserService.getById(shiroUser.getId());
		return loginUser;
	}

}
